
/*
 * AppUmis.java
 *
 * Created on 28-ago-2010, 15:25:30
 */

package umis2.vista;

import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.util.List;
import javax.swing.JOptionPane;
import umis2.controladorcentral.Acotador;
import umis2.controladorcentral.DiccionarioImagen;
import umis2.controladorcentral.Forma;
import umis2.controladorcentral.Transformador;
import umis2.nivel.Nivel;
import umis2.nivel.NivelBuilderDirector;
import umis2.nivel.NivelUnoBuilder;
import umis2.nivel.Personaje;
import umis2.nivel.ProxySync;

/**
 * Esta tendra la clase principal
 * @author djphilomath
 */
public class AppUmis extends javax.swing.JFrame {

    /** Creates new form AppUmis */
    public AppUmis() {
        initComponents();
    }

    public void setFormas(List<Forma> formas) {
        canvas1.setFormas(formas);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        canvas1 = new umis2.vista.Canvas();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        org.jdesktop.layout.GroupLayout canvas1Layout = new org.jdesktop.layout.GroupLayout(canvas1);
        canvas1.setLayout(canvas1Layout);
        canvas1Layout.setHorizontalGroup(
            canvas1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 1065, Short.MAX_VALUE)
        );
        canvas1Layout.setVerticalGroup(
            canvas1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 601, Short.MAX_VALUE)
        );

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(canvas1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(canvas1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() 
            {
                NivelBuilderDirector director = new NivelBuilderDirector();
                NivelUnoBuilder nivelUnoBuilder = new NivelUnoBuilder();
                director.setNivelBuilder(nivelUnoBuilder);
                director.constructNivel();
                Nivel nivel1 = director.getNivel();
                Vista.setNivel(nivel1);
                Vista.setPanel(new AppUmis());
                Vista.getPanel().addKeyListener(canvas1);
                Vista.getPanel().setVisible(true);
                Vista.setProxy(new ProxySync());
                Vista.getProxy().conectar();
                DiccionarioImagen.cargar();
                Transformador.getInstance().actualizarVista();
            }

        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    public static umis2.vista.Canvas canvas1;
    // End of variables declaration//GEN-END:variables

}
